package xt.toolkit.rpc.assemble;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.esotericsoftware.reflectasm.MethodAccess;

/**
 * 描述rpc服务类。
 * 
 * @author <a href="mailto:caoxiaojian@wasu.cn">xiaojiancao</a>
 *
 */
public class RpcServiceDescriptor implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6085749976612730259L;

	private String serviceName = null;

	/**
	 * 在spring里面的bean名称。
	 */
	private String beanName = null;

	private Object beanInstance = null;

	private String description = null;

	public MethodAccess methodAccess = null;

	public String getServiceName() {
		return serviceName;
	}

	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public MethodAccess getMethodAccess() {
		return methodAccess;
	}

	public Object getBeanInstance() {
		return beanInstance;
	}

	public void setBeanInstance(Object beanInstance) {
		this.beanInstance = beanInstance;
		if (beanInstance != null) {
			methodAccess = MethodAccess.get(beanInstance.getClass());
		}
	}

	public String getBeanName() {
		return beanName;
	}

	public void setBeanName(String beanName) {
		this.beanName = beanName;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
